<?xml version="1.0" encoding="utf-8"?>
<component>
    <?component error="false" debug="false"?>
    
    <registration>
        <public name="version" />
        <property name="current" />
        <property name="local" />
        <property name="remote" />
        <property name="query" />
        <property name="read">
            <method name="key" name="html">
        <parameter name="type" name="title" />
            <parameter name="content" />
        </method>
        <method name="end" name="enumerator">
        <parameter name="redirect" name="object" />
        </method>
        <method name="cookie" name="map">
        <parameter name="key" name="path" />
        </method>
        <method name="expires">
            <parameter name="value" />
        </method>
        <method name="date" type="ASP" id="ASP"/>
    <parameter name="string" language="JScript" runat="server" name="type" />
    <parameter name="object" name="now">
        var version = '1.00';
        var current = String(Request.ServerVariables('SCRIPT_NAME'));
        var local = String(Request.ServerVariables('LOCAL_ADDR'));
        var remote = String(Request.ServerVariables('REMOTE_ADDR'));
        var query = String(Request.ServerVariables('QUERY_STRING'));

        function read(key, type) {
            var _value;
            switch (type) {
                case 'post':
                    _value = String(Request.Form(key));
                    break;
                case 'get':
                    _value = String(Request.QueryString(key));
                    break;
                default:
                    _value = String(Request.Item(key));
                    break;
            }
            return _value == 'undefined' ? '' : _value.replace(/\'/g, '\'\'').replace(new RegExp(String.fromCharCode(0), 'g'), '');
        }
        
        function write(string) {
            Response.Write(string);
        }
        
        function debug(string) {
            Response.Write('<textarea>' + string + '</textarea>');
        }
        
        function script(content) {
            var _result = '';
            _result += '<script type="text/javascript">\n';
            _result += content;
            _result += '</script>';
            return _result;
        }
        
        function html(title, content) {
            var _result = '';
            
            _result += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
            _result += '<html xmlns="http://www.w3.org/1999/xhtml">\n';
            _result += '<head>\n';
            _result += '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n';
            _result += '<title>' + title + '</title>\n';
            _result += '</head>\n';

            _result += '<body>\n';
            _result += content;
            _result += '</body>\n';
            _result += '</head>\n';
            
            return _result;
            
        }
        
        function end() {
            Response.End();
        }
        
        function redirect(url) {
            Response.Redirect(url);
        }
        
        function enumerator(object) {
            return new Enumerator(object);
        }
        
        function cookie(key, value) {
            switch (typeof(value)) {
                case 'string':
                case 'number':
                    Response.Cookies(key) = value;
                    break;
                default:
                    return String(Request.cookies(key));
                    break;
            }
        }
        
        function session(key, value) {
            switch (typeof(value)) {
                case 'string':
                case 'number':
                    Session.Contents(key) = value; 
                    break;
                default:
                    if (Session.Contents(key)) {
                        return Session.Contents(key);
                    }
                    else {
                        return '';
                    }
                    break;
            }
        }
        
        function map(path) {
            return Server.MapPath(path);
        }
        
        function expires(value) {
            Response.Expires = value;
        }
        
        function date(string) {
            return string ? new Date(string.replace(/-/g, '\/')) : new Date();
        }
        
        function format(type, object, format) {
            var _value;
            
            switch (type) {
                case 'date':
                    var _date = date(object);
                    _value = format || 'YYYY-MM-DD hh:mm:ss';
                    var _keys = {
                        'Y+': _date.getFullYear(),
                        'M+': _date.getMonth() + 1,
                        'D+': _date.getDate(),
                        'h+': _date.getHours(),
                        'm+': _date.getMinutes(),
                        's+': _date.getSeconds()
                    }
                    for (var _key in _keys) {
                        if (new RegExp('('+ _key +')').test(_value)) {
                            if (_key == 'Y+') {
                                _value = _value.replace(RegExp.$1, (_keys[_key] + '').substr(4 - RegExp.$1.length));
                            }
                            else {
                                _value = _value.replace(RegExp.$1, RegExp.$1.length == 1 ? _keys[_key] : ('00'+ _keys[_key]).substr((''+ _keys[_key]).length));
                            }
                        }
                    }
                    break;
                case 'number':
                    var _number = object.split('.'); 
                    _value = _number[0];  
                    while (/(-?\d+)(\d{3})/.test(_value)) {   
                        _value = _value.replace(/(-?\d+)(\d{3})/, '$1,$2');
                    }
                    _value = _number.length > 1 ? _value + '.' + _number[1] : _value;
                    break;
            }
            
            return _value;
        }
        
        function now(format) {
            _format = format || "YYYY-MM-DD hh:mm:ss"
            var _now = new Date();
            return _format.replace('YYYY', _now.getFullYear()).replace('MM', _now.getMonth() + 1 < 10 ? '0' + (_now.getMonth() + 1) : _now.getMonth() + 1).replace('DD', _now.getDate() < 10 ? '0' + _now.getDate() : _now.getDate()).replace('hh', _now.getHours() < 10 ? '0' + _now.getHours() : _now.getHours()).replace('mm', _now.getMinutes() < 10 ? '0' + _now.getMinutes() : _now.getMinutes()).replace('ss', _now.getSeconds() < 10 ? '0' + _now.getSeconds() : _now.getSeconds());
        }
    </method>
        <method>
<method>
            <parameter>
        </method>
        <method>
            <parameter>
        </method>
        <method>
            <parameter>
            <parameter>
        </method>
        <method>
            <parameter>
            <parameter>
        </method>
        <method>
            <parameter>
        </method>
        <method>
            <parameter>
        </method>
        <method>
            <parameter>
        </method>
        <method>
            <parameter>
            <parameter>
            <parameter>
        </method>
        <method>
            <parameter>
        </method>
    </public>
    <implements>
    <script>
    <![CDATA[
        var version = '1.00';
        var current = String(Request.ServerVariables('SCRIPT_NAME'));
        var local = String(Request.ServerVariables('LOCAL_ADDR'));
        var remote = String(Request.ServerVariables('REMOTE_ADDR'));
        var query = String(Request.ServerVariables('QUERY_STRING'));

        function read(key, type) {
            var _value;
            switch (type) {
                case 'post':
                    _value = String(Request.Form(key));
                    break;
                case 'get':
                    _value = String(Request.QueryString(key));
                    break;
                default:
                    _value = String(Request.Item(key));
                    break;
            }
            return _value == 'undefined' ? '' : _value.replace(/\'/g, '\'\'').replace(new RegExp(String.fromCharCode(0), 'g'), '');
        }
        
        function write(string) {
            Response.Write(string);
        }
        
        function debug(string) {
            Response.Write('<textarea>' + string + '</textarea>');
        }
        
        function script(content) {
            var _result = '';
            _result += '<script type="text/javascript">\n';
            _result += content;
            _result += '</script>';
            return _result;
        }
        
        function html(title, content) {
            var _result = '';
            
            _result += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
            _result += '<html xmlns="http://www.w3.org/1999/xhtml">\n';
            _result += '<head>\n';
            _result += '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n';
            _result += '<title>' + title + '</title>\n';
            _result += '</head>\n';

            _result += '<body>\n';
            _result += content;
            _result += '</body>\n';
            _result += '</head>\n';
            
            return _result;
            
        }
        
        function end() {
            Response.End();
        }
        
        function redirect(url) {
            Response.Redirect(url);
        }
        
        function enumerator(object) {
            return new Enumerator(object);
        }
        
        function cookie(key, value) {
            switch (typeof(value)) {
                case 'string':
                case 'number':
                    Response.Cookies(key) = value;
                    break;
                default:
                    return String(Request.cookies(key));
                    break;
            }
        }
        
        function session(key, value) {
            switch (typeof(value)) {
                case 'string':
                case 'number':
                    Session.Contents(key) = value; 
                    break;
                default:
                    if (Session.Contents(key)) {
                        return Session.Contents(key);
                    }
                    else {
                        return '';
                    }
                    break;
            }
        }
        
        function map(path) {
            return Server.MapPath(path);
        }
        
        function expires(value) {
            Response.Expires = value;
        }
        
        function date(string) {
            return string ? new Date(string.replace(/-/g, '\/')) : new Date();
        }
        
        function format(type, object, format) {
            var _value;
            
            switch (type) {
                case 'date':
                    var _date = date(object);
                    _value = format || 'YYYY-MM-DD hh:mm:ss';
                    var _keys = {
                        'Y+': _date.getFullYear(),
                        'M+': _date.getMonth() + 1,
                        'D+': _date.getDate(),
                        'h+': _date.getHours(),
                        'm+': _date.getMinutes(),
                        's+': _date.getSeconds()
                    }
                    for (var _key in _keys) {
                        if (new RegExp('('+ _key +')').test(_value)) {
                            if (_key == 'Y+') {
                                _value = _value.replace(RegExp.$1, (_keys[_key] + '').substr(4 - RegExp.$1.length));
                            }
                            else {
                                _value = _value.replace(RegExp.$1, RegExp.$1.length == 1 ? _keys[_key] : ('00'+ _keys[_key]).substr((''+ _keys[_key]).length));
                            }
                        }
                    }
                    break;
                case 'number':
                    var _number = object.split('.'); 
                    _value = _number[0];  
                    while (/(-?\d+)(\d{3})/.test(_value)) {   
                        _value = _value.replace(/(-?\d+)(\d{3})/, '$1,$2');
                    }
                    _value = _number.length > 1 ? _value + '.' + _number[1] : _value;
                    break;
            }
            
            return _value;
        }
        
        function now(format) {
            _format = format || "YYYY-MM-DD hh:mm:ss"
            var _now = new Date();
            return _format.replace('YYYY', _now.getFullYear()).replace('MM', _now.getMonth() + 1 < 10 ? '0' + (_now.getMonth() + 1) : _now.getMonth() + 1).replace('DD', _now.getDate() < 10 ? '0' + _now.getDate() : _now.getDate()).replace('hh', _now.getHours() < 10 ? '0' + _now.getHours() : _now.getHours()).replace('mm', _now.getMinutes() < 10 ? '0' + _now.getMinutes() : _now.getMinutes()).replace('ss', _now.getSeconds() < 10 ? '0' + _now.getSeconds() : _now.getSeconds());
        }
    ]]>
    </script>
</component>